package com.repository.enums;

import lombok.Getter;

@Getter
public enum ResultCode {
    SUCCESS(200,"成功"),
    FAIL(500,"失败");
//    UNAUTHORIZED(401,"未认证（签名错误）"),
//    NOT_FOUND(404,"接口不存在");

    public int code;

    public String desc;

    ResultCode(int code, String desc){
        this.code=code;
        this.desc=desc;
    }

    public static ResultCode getByCode(int codeVal){
        for(ResultCode resultCode : ResultCode.values()){
            if(resultCode.getCode() == codeVal){
                return resultCode;
            }
        }
        return null;
    }
}
